#define COLOR_GREEN  RGB888(0x00, 0xff, 0x00)
#define COLOR_YELLOW RGB888(0xff, 0xff, 0x00)
#define COLOR_WHITE  RGB888(0xff, 0xff, 0xff)
#define COLOR_RED    RGB888(0xff, 0x00, 0x00)

const uint8_t carbitmap_data[] = {
   0b00000000, 0b01111100, 0b00000000,
   0b00000000, 0b01111100, 0b00000000,
   0b00111110, 0b01111100, 0b11111000,
   0b00111110, 0b01111100, 0b11111000,   
   0b00111111, 0b11111111, 0b11111000,
   0b00111111, 0b11111111, 0b11111000,
   0b00111110, 0b01111100, 0b11111000,
   0b00111110, 0b01111100, 0b11111000,  
   0b00000000, 0b01111100, 0b00000000,
   0b00000000, 0b01111100, 0b00000000,
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b01111111, 0b11111111, 0b11111100,
   0b01111111, 0b11111111, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,   
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b00000000, 0b00000000, 0b00000000,
   0b00000000, 0b00000000, 0b00000000,
   0b00000000, 0b00000000, 0b00000000,
};

const uint8_t carbitmap_data_dreta[] = {
   0b00000000, 0b00111110, 0b00000000,
   0b00000000, 0b00111110, 0b00000000,
   0b00011111, 0b00111110, 0b01111100,
   0b00010001, 0b00111110, 0b01111100,
   0b00011111, 0b11111111, 0b11000100,
   0b00010001, 0b11111111, 0b11111100,
   0b00011111, 0b00111110, 0b01000100,
   0b00011111, 0b00111110, 0b01111100,
   0b00000000, 0b00111110, 0b00000000,
   0b00000000, 0b01111100, 0b00000000,
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b01000010, 0b01111100, 0b10000100,
   0b01111111, 0b11111111, 0b11111100,
   0b01111111, 0b11111111, 0b11111100,
   0b01000010, 0b01111100, 0b10000100,
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b00000000, 0b00000000, 0b00000000,
   0b00000000, 0b00000000, 0b00000000,
   0b00000000, 0b00000000, 0b00000000
};

const uint8_t carbitmap_data_esquerra[] = {
   0b00000000, 0b11111000, 0b00000000,
   0b00000000, 0b11111000, 0b00000000,
   0b01111100, 0b11111001, 0b11110000,
   0b01111100, 0b11111001, 0b00010000,
   0b01000111, 0b11111111, 0b11110000,
   0b01111111, 0b11111111, 0b00010000,
   0b01000100, 0b11111001, 0b11110000,
   0b01111100, 0b11111001, 0b11110000,
   0b00000000, 0b11111000, 0b00000000,
   0b00000000, 0b01111100, 0b00000000,
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b01000010, 0b01111100, 0b10000100,
   0b01111111, 0b11111111, 0b11111100,
   0b01111111, 0b11111111, 0b11111100,
   0b01000010, 0b01111100, 0b10000100,
   0b01111110, 0b01111100, 0b11111100,
   0b01111110, 0b01111100, 0b11111100,
   0b00000000, 0b00000000, 0b00000000,
   0b00000000, 0b00000000, 0b00000000,
   0b00000000, 0b00000000, 0b00000000
};

const uint8_t carbitmap_data_crash[] = {
  0x01, 0xF8, 0x00,
  0x00, 0xFC, 0x1F,
  0x3E, 0xFC, 0x1F,
  0x3E, 0x7C, 0xFF,
  0x7C, 0x7E, 0xFE,
  0x7F, 0x7E, 0x3E,
  0xF8, 0x3F, 0x3E,
  0xF8, 0x00, 0x00,
  0x00, 0x3E, 0x00,
  0xF8, 0x3E, 0x00,
  0xF8, 0x3E, 0x00,
  0xFC, 0x3C, 0x7E,
  0x7F, 0xFC, 0x7E,
  0x7F, 0xFF, 0xFC,
  0x7E, 0x7F, 0xFC,
  0x3F, 0x7C, 0xFC,
  0x3F, 0x7C, 0xF8,
  0x3F, 0x7D, 0xF8,
  0x00, 0x01, 0xF8,
  0x00, 0x00, 0x00,
  0x00, 0x00, 0x00,
};

const uint8_t carbitmap_data_crash2[] = {
    0,  31, 128,
  248,  63,   0,
  248,  63, 124,
  255,  62, 124,
  127, 126,  62,
  124, 126, 254,
  124, 252,  31,
    0,   0,  31,
    0, 124,   0,
    0, 124,  31,
    0, 124,  31,
  126,  60,  63,
  126,  63, 254,
   63, 255, 254,
   63, 254, 126,
   63,  62, 252,
   31,  62, 252,
   31, 190, 252,
   31, 128,   0,
    0,   0,   0,
    0,   0,   0
};

const uint8_t carbitmap_data_anim0[] = {
0x00, 0x7C, 0x00,
0x00, 0x7C, 0x00,
0x3F, 0x7D, 0xF8,
0x21, 0x7D, 0x08,
0x3F, 0xFF, 0xF8,
0x3F, 0xFF, 0xF8,
0x3F, 0x7D, 0xF8,
0x3F, 0x7D, 0xF8,
0x00, 0x7C, 0x00,
0x00, 0x7C, 0x00,
0x7F, 0x7D, 0xFC,
0x41, 0x7D, 0x04,
0x7F, 0x7D, 0xFC,
0x7F, 0xFF, 0xFC,
0x41, 0xFF, 0x04,
0x7F, 0x7D, 0xFC,
0x7F, 0x7D, 0xFC,
0x7F, 0x7D, 0xFC,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
};

const uint8_t carbitmap_data_anim1[] = {
  
0x00, 0x7C, 0x00,
0x00, 0x7C, 0x00,
0x3F, 0x7D, 0xF8,
0x3F, 0x7D, 0xF8,
0x21, 0xFF, 0x08,
0x21, 0xFF, 0x08,
0x3F, 0x7D, 0xF8,
0x3F, 0x7D, 0xF8,
0x00, 0x7C, 0x00,
0x00, 0x7C, 0x00,
0x7F, 0x7D, 0xFC,
0x7F, 0x7D, 0xFC,
0x41, 0x7D, 0x04,
0x7F, 0xFF, 0xFC,
0x7F, 0xFF, 0xFC,
0x41, 0x7D, 0x04,
0x7F, 0x7D, 0xFC,
0x7F, 0x7D, 0xFC,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
};

const uint8_t carbitmap_data_anim2[] = {

0x00, 0x7C, 0x00,
0x00, 0x7C, 0x00,
0x3F, 0x7D, 0xF8,
0x3F, 0x7D, 0xF8,
0x3F, 0xFF, 0xF8,
0x3F, 0xFF, 0xF8,
0x21, 0x7D, 0x08,
0x3F, 0x7D, 0xF8,
0x00, 0x7C, 0x00,
0x00, 0x7C, 0x00,
0x7F, 0x7D, 0xFC,
0x7F, 0x7D, 0xFC,
0x7F, 0x7D, 0xFC,
0x41, 0xFF, 0x04,
0x7F, 0xFF, 0xFC,
0x7F, 0x7D, 0xFC,
0x41, 0x7D, 0x04,
0x7F, 0x7D, 0xFC,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
};

#define FONT_SCALE 4
#define FONT_WIDTH 3
#define FONT_HEIGHT 5

const  uint8_t number_data_3x5[10][8] = {
  { // 0     
     0b11100000,
     0b10100000,
     0b10100000,
     0b10100000,
     0b11100000,    

  },
  { // 1
     0b01000000,
     0b01000000,
     0b01000000,
     0b01000000,
     0b01000000,    
     0,0,0
  },
  { //2
     0b11100000,
     0b00100000,
     0b11100000,
     0b10000000,
     0b11100000,
     0,0,0
  },
  { //3
     0b11100000,
     0b00100000,
     0b01100000,
     0b00100000,
     0b11100000,
     0,0,0
  },
  {//4
     0b10000000,
     0b10000000,
     0b10100000,
     0b11100000,
     0b00100000,
     0,0,0
  },
  {//5
     0b11100000,
     0b10000000,
     0b11100000,
     0b00100000,
     0b11100000,
     0,0,0
  },
  {//6
     0b10000000,
     0b10000000,
     0b11100000,
     0b10100000,
     0b11100000,
     0,0,0
  },
  {//7
     0b11100000,
     0b00100000,
     0b00100000,
     0b00100000,
     0b00100000,
     0,0,0
  },
  {//8
     0b11100000,
     0b10100000,
     0b11100000,
     0b10100000,
     0b11100000,
     0,0,0
  },
  {//9
     0b11100000,
     0b10100000,
     0b11100000,
     0b00100000,
     0b11100000,
     0,0,0
  }
  
};

const  uint8_t won_data[] =
{
  // 16x8
      0b00000000,0b00000000,
      0b01000101,0b11010010,
      0b01000101,0b01011010,
      0b01000101,0b01010110,      
      0b01010101,0b01010110,
      0b00101001,0b11010010,
      0b00000000,0b00000000,
      0b00000000,0b00000000,
};

const  uint8_t lost_data[] =
{
  // 16x8
      0b00000000,0b00000000,
      0b01001110,0b11101110,
      0b01001010,0b10000100,
      0b01001010,0b11100100,      
      0b01001010,0b00100100,
      0b01101110,0b11100100,
      0b00000000,0b00000000,
      0b00000000,0b00000000,
};

const uint8_t bitmap_classicracer_data[] = {


0x03, 0xF0, 0x7C, 0x00, 0xFC, 0x03, 0xF8, 0x0F, 0xE1, 0xF0, 0x1F, 0x80, 0x1F, 0xF8, 0x07, 0xE0, 0x0F, 0xC1, 0xFF, 0x9F, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x3E, 0x7C, 0x01, 0xFC, 0x1E, 0x7C, 0x79, 0xF1, 0xF1, 0xF1, 0xF0, 0x1F, 0x3E, 0x0F, 0xE0, 0xF8, 0xF9, 0xF0, 0x1F, 0x3E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7C, 0x3C, 0xFC, 0x03, 0x7C, 0x3C, 0x7C, 0xF1, 0xF3, 0xF3, 0xE1, 0xE0, 0x3F, 0x3E, 0x1B, 0xE1, 0xF0, 0xF3, 0xF0, 0x3F, 0x3E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFC, 0x00, 0xF8, 0x06, 0x7C, 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FC, 0x7D, 0x81, 0xF0, 0xFF, 0xEF, 0xFC, 0xFC, 0x7C,
0x1F, 0xC3, 0xFF, 0x60, 0x3E, 0x3F, 0x80, 0xFE, 0x0F, 0x80, 0xFE, 0x00, 0xF8, 0x7F, 0x01, 0xF0, 0x7F, 0x0F, 0xFC, 0xF8, 0x7C

};

const uint8_t bitmap_caricon_data[] = {

     0b00011000,
     0b01011010,
     0b01111110,
     0b01011010,
     0b00011000,
     0b11011011,
     0b11111111,
     0b11011011,
};

const uint8_t bitmap_cariconright_data[] = {

     0b01100000,
     0b01101000,
     0b11111000,
     0b01101000,
     0b01100000,
     0b01101100,
     0b01111100,
     0b01101100,
};

const uint8_t bitmap_cariconleft_data[] = {

     0b00001100,
     0b00101100,
     0b00111110,
     0b00101100,
     0b00001100,
     0b01101100,
     0b01111110,
     0b01101100,
};


const uint8_t bitmap_mouse_data[] = {
  
     0b11111110,
     0b10010010,
     0b10010010,
     0b11111110,
     0b10000010,
     0b10000010,
     0b10000010,
     0b01111100,
};

const uint8_t bitmap_keyba_data[] = {
  
     0b01110010,
     0b11011010,
     0b11011010,
     0b11111011,
     0b11011011,
     0b00000011,
     0b11111111,
     0b00001111,
};

const uint8_t bitmap_keybb_data[] = {
  
     0b00100010,
     0b01110010,
     0b10101010,
     0b00100011,     
     0b00100011,
     0b00000011,
     0b11111111,
     0b00001111,
};

const uint8_t bitmap_keybo_data[] = {
  
     0b11111010,
     0b10101010,
     0b10111010,
     0b10100011,    
     0b11100011,
     0b00000011,
     0b11111111,
     0b00001111,
};


const uint8_t bitmap_joystick_data[] = {
  
     0b00011000,
     0b00111100,
     0b00111100,
     0b00011000,
     0b00011000,
     0b11011000,
     0b11111111,
     0b11111111,
};

const uint8_t bitmap_car_to_right_data[] = {
  
     0b11100000,
     0b11101110,
     0b01000100,
     0b11111111,     
     0b11111111,
     0b01000100,
     0b11101110,
     0b11100000,     
};
